import config from '../config.js';




// ---- api地址 ----
let apiBase = 'http://tuikeshiwan.com/api/'

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下

	let apiGetProjectList = (params = {}) => vm.$u.http.post(apiBase + 'app/getProjectList', params);
	let apiAddProjectRecord = (params = {}) => vm.$u.http.post(apiBase + 'app/addProjectRecord', params);
	let apiGetProjectRecordList = (params = {}) => vm.$u.http.post(apiBase + 'app/getProjectRecordList', params);
	let apiGetdic = (params = {}) => vm.$u.http.post(apiBase + 'public/getdic', params);
	let apiGetNoticeList = (params = {}) => vm.$u.http.post(apiBase + 'app/getNoticeList', params);
	let apiRegister = (params = {}) => vm.$u.http.post(apiBase + 'wx/register', params);
	let apiLogin = (params = {}) => vm.$u.http.post(apiBase + 'wx/login', params);
	let apiGetUser = (params = {}) => vm.$u.http.post(apiBase + 'app/getUser', params);
	let apiUpdateUser = (params = {}) => vm.$u.http.post(apiBase + 'app/updateUser', params);
	let apiGetUserFX = (params = {}) => vm.$u.http.post(apiBase + 'app/getUserFX', params);
	let apiHotRank = (params = {}) => vm.$u.http.post(apiBase + 'app/hot', params);
	let apiDisJE = (params = {}) => vm.$u.http.post(apiBase + 'app/disJE', params);
	let apiMyTeam = (params = {}) => vm.$u.http.post(apiBase + 'app/myTeam', params);
	let apiWithDraw = (params = {}) => vm.$u.http.post(apiBase + 'app/addSysWithdrawals', params);
	let apiWithDrawHis = (params = {}) => vm.$u.http.post(apiBase + 'app/getSysWithdrawals', params);

	vm.$u.api = {
		apiGetProjectList,
		apiAddProjectRecord,
		apiGetProjectRecordList,
		apiGetdic,
		apiGetNoticeList,
		apiRegister,
		apiLogin,
		apiGetUser,
		apiUpdateUser,
		apiGetUserFX,
		apiHotRank,
		apiDisJE,
		apiMyTeam,
		apiWithDraw,
		apiWithDrawHis,
	};
}

export default {
	install
}